@FunctionalInterface  // java8新出现
interface Foo {
//    void sayHello();
    int add(int x, int y);

    default int mul(int x, int y) {  //java8新出现
        return x * y;
    }

    default int mul2(int x, int y) {  //java8新出现
        return x * y;
    }

    public static int div(int x, int y) {
        return x/y;
    }

    public static int div2(int x, int y) {
        return x/y;
    }
}

/**
 * 1 拷贝小括号，写死右箭头，落地大括号
 * 2 @FunctionalInterface
 * 3 default
 * 4 函数式接口才能用lambda表达式
 * 5 static
 */
public class LambdaExpressDemo2 {
    public static void main(String[] args) {
//        Foo foo = new Foo() {
//            @Override
//            public void sayHello() {
//                System.out.println("helloworld");
//            }
//
//            @Override
//            public int add(int x, int y) {
//                return 0;
//            }
//        };
//        foo.sayHello();

//        Foo foo = () -> { System.out.println("hello");};
//        foo.sayHello();

        Foo foo = (int x, int y)-> {
            System.out.println("hello");
            return x+y;
        };
        System.out.println(foo.add(3, 5));
        System.out.println(foo.mul(3,5));
        System.out.println(Foo.div(6,3));
    }
}
